package com.healthy.service;

import com.healthy.entity.Consult;
import com.healthy.entity.TestInformation;
import com.healthy.mapper.ConsultMapper;
import com.healthy.mapper.TestInformationMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ConsultService {


    @Autowired
    ConsultMapper consultMapper;

    //    查询全部
    public List<Consult> cuList() {
        return consultMapper.culist();
    }

    //    添加
    public Consult cuInsert(Consult consult) {

        consultMapper.cuInsert(consult);
        return consult;
    }

    //    删除
    public int cuDeleteByid(int id) throws Exception {
        int res = consultMapper.cuDeleteByid(id);
        if (res > 0) {
            return 1;
        } else {
            return 0;
        }
    }
    //    修改
    public int cuUpdateByid(int id,String name,String content,String examination,String doctor) throws Exception {
        int res = consultMapper.cuUpdateByid(id,name,content,examination,doctor);
        if (res > 0) {
            return 1;
        } else {
            return 0;
        }
    }
}
